fn main() {
	// maps can have keys of type string, rune, integer, float or voidptr
	mut m := map[string]int{} // a map with `string` keys and `int` values
	m['one'] = 1
	m['two'] = 2
	println(m['one'])       // "1"
	println(m['bad_key'])   // "0"
	println('bad_key' in m) // Use `in` to detect whether such key exists
	println(m.keys())       // ['one', 'two']
	m.delete('two')
	
	// the whole map can be initialized using short syntax
	numbers := {
	'one': 1
	'two': 2
	}
	println(numbers)
	
	// if a key is not found, a zero value is returned by default
	sm := {
		'abc': 'xyz'
	}
	val := sm['bad_key']
	println(val) // ''

	// it's also possible to use an or {} block to handle missing keys
	mm := map[string]int{}
	val_2 := mm['bad_key'] or { panic('key not found') }
	
	// if a key is present, and get its value, if it was present, in one go
	m_2 := {
		'abc': 'def'
	}
	if v := m_2['abc'] {
		println('the map value for that key is: $v')
	}
	
	// the same optional check applies to arrays
	arr := [1, 2, 3]
	large_index := 999
	val_3 := arr[large_index] or { panic('out of bounds') }
	println(val)
	
	// you can also do this, if you want to *propagate* the access error:
	val_4 := arr[333]?
	println(val_4)
}
